﻿@model Telerik.Web.Mvc.GridModel<AuthenticationMethodModel>
@using Telerik.Web.Mvc.UI

<div class="section-header">
    <div class="title">
        <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
        @T("Admin.Configuration.ExternalAuthenticationMethods")
    </div>
</div>
<table class="adminContent">
    <tr>
        <td>
            @(Html.Telerik().Grid<AuthenticationMethodModel>()
                    .Name("authenticationmethods-grid")
                    .DataKeys(x =>
                    {
                        x.Add(y => y.SystemName).RouteKey("systemName");
                    })
                    .BindTo(Model.Data)
                    .Columns(columns =>
                    {
                        columns.Bound(x => x.FriendlyName)
                            .Width(150)
                            .ReadOnly();
                        columns.Template(
                                @<div>
                                    @Html.ActionLink(T("Admin.Configuration.ExternalAuthenticationMethods.Configure").Text, "ConfigureMethod", new { systemName = @item.SystemName })
                                </div>
                            )
                            .ClientTemplate("<a href=\"ConfigureMethod?systemName=<#= SystemName #>\">" + T("Admin.Configuration.ExternalAuthenticationMethods.Configure").Text + "</a>")
                            .Width(100)
                            .Centered()
                            .Title(T("Admin.Configuration.ExternalAuthenticationMethods.Configure").Text);
                        columns.Bound(x => x.SystemName).Width(150).ReadOnly();
                        columns.Bound(x => x.DisplayOrder)
                            .Width(100)
                            .ReadOnly();
                        columns.Bound(x => x.IsActive)
                            .Template(x => x.IsActive.ToString().ToLower())
                            .Width(100);
                        columns.Command(commands =>
                        {
                            commands.Edit();
                        }).Width(100);
                    })
                    .DataBinding(dataBinding =>
                    {
                        dataBinding.Ajax().Select("Methods", "ExternalAuthentication")
                            .Update("MethodUpdate", "ExternalAuthentication");
                    })
                    .EnableCustomBinding(true))
        </td>
    </tr>
</table>
